home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE21 / EX14.C < prev    next >
C/C++ Source or Header  |  1995-05-29  |  2KB  |  43 lines

  1. #include <genstub.c>
  2.  
  3. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  4. {
  5.  
  6.    switch (uMsg)
  7.    {
  8.          case WM_COMMAND:
  9.                switch ( LOWORD( wParam ) )
  10.                {
  11.                      case IDM_TEST:
  12.                      {
  13.                            char          szTitle[128];
  14.                            char          szBuffer[128];
  15.                            OSVERSIONINFO osvi;
  16.                            DWORD         dwVersion = GetVersion();
  17.  
  18.                            osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  19.                            GetVersionEx( &osvi );
  20.  
  21.                            wsprintf( szTitle, "Windows version is %d.%d",
  22.                                      LOBYTE(LOWORD(dwVersion)),   // major revision
  23.                                      HIBYTE(LOWORD(dwVersion)) ); // minor revision
  24.                            wsprintf( szBuffer, "Build: %d, Platform ID: %ld",
  25.                                      LOWORD(osvi.dwBuildNumber),
  26.                                      osvi.dwPlatformId);
  27.                            MessageBox( hWnd, szBuffer, szTitle, MB_OK );
  28.                      }
  29.                      break;
  30.                      case IDM_EXIT:
  31.                            DestroyWindow( hWnd );
  32.                            break;
  33.                }
  34.                break;
  35.                case WM_DESTROY:
  36.                      PostQuitMessage( 0 );
  37.                break;
  38.          default:
  39.                return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  40.    }
  41.    return (NULL);
  42. }
  43.